import { config } from '../../config/index';
import { getTouristSchoolId } from '../../userData/userData'
/** 获取商品列表 */
export function fetchGoodsList(pageIndex = 1, pageSize = 20) {
  // if (config.useMock) {
  // return mockFetchGoodsList(pageIndex, pageSize);
  // }
  return new Promise((resolve) => {
    // resolve('real api');
    wx.cloud.callFunction({
      name: "good_getGoodListforInstitution",
      data: {
        institution_id: getTouristSchoolId()//"e54110dd644a5301002b870a50f78567"
      }
    }).then(res => {
      var goods = res.result;
      const app = getApp();
      app.globalData.allGoods = goods;
      resolve(goods);
    })
  });
}
